package kr.co.hk.sdoku;

import java.util.ArrayList;

public class RandomDisposition {
	int[][] mStoku;
	int[][] list;
	int[][] nList;
	
	public RandomDisposition(){
		mStoku = new int[9][9];
		list = new int[9][9];
		nList = new int[9][9];
	}
	
	public void makeList(){
		Sdoku sdoku = new Sdoku();
		sdoku.make();
		mStoku = sdoku.getSdoku();
		for (int i = 0; i < mStoku.length; i++) {
			for (int j = 0; j < mStoku[i].length; j++) {
				switch (i) {
				case 0:
					list[i][j]=mStoku[i][j];
					break;
				case 1:
					list[i][j]=mStoku[i][j];
					break;
				case 2:
					list[i][j]=mStoku[i][j];
					break;
				case 3:
					list[i][j]=mStoku[i][j];
					break;
				case 4:
					list[i][j]=mStoku[i][j];
					break;
				case 5:
					list[i][j]=mStoku[i][j];
					break;
				case 6:
					list[i][j]=mStoku[i][j];
					break;
				case 7:
					list[i][j]=mStoku[i][j];
					break;
				case 8:
					list[i][j]=mStoku[i][j];
					break;
				}
			}
		}
	}
	
	public void randomPosition(){
		int ranNum = (int)(Math.random()*9)+1;
		for (int i = 0; i < list.length; i++) {
			int position = (int)(Math.random()*9);
			for (int j = 0; j < list[i].length; j++) {
				switch (i) {
				case 0:
					nList[i][position]=ranNum;
					break;
				case 1:
					nList[i][position]=ranNum;
					break;
				case 2:
					nList[i][position]=ranNum;
					break;
				case 3:
					nList[i][position]=ranNum;
					break;
				case 4:
					nList[i][position]=ranNum;
					break;
				case 5:
					nList[i][position]=ranNum;
					break;
				case 6:
					nList[i][position]=ranNum;
					break;
				case 7:
					nList[i][position]=ranNum;
					break;
				case 8:
					nList[i][position]=ranNum;
					break;
				}// switch ~ case
			}// inner for
		}// outter for
	}
	
	public static void main(String[] args) {
		RandomDisposition random = new RandomDisposition();
		random.makeList();
		random.randomPosition();
		int[][] l = random.nList;
		for (int i = 0; i < l.length; i++) {
			for (int j = 0; j < l[i].length; j++) {
				System.out.print(l[i][j]+"\t");
			}
			System.out.println();
		}
	}
	
}
